
package com.rt.schedulenew.api;

import com.rt.schedulebase.dto.*;
import com.rt.schedulebase.entity.DictCommonUse;
import com.rt.schedulebase.entity.ExamSchedule;
import com.rt.schedulebase.entity.ExamScheduleApm;
import com.rt.schedulenew.dto.SignScheduleDto;
import com.rt.schedulenew.dto.WaitingDto;
import com.rt.schedulenew.utils.global.JsonResult;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface ICommonService {
    List<String> getSickIds(ExamApplyDto p0);

    List<ExamApplyDto> mergeApply(List<ExamApplyDto> p0, String p1, String p2, String p3);

    ExamApplyDto getApplyNos(ExamApplyDto p0);

    ExamApplyDto getScheduleToExamApply(ExamApplyDto p0, ExamApplyDto p1);

    ExamApplyDto getExamApplyInfo(String applyNo, String terminalType);

    Map<String, Object> judgeTimeSignin(ExamApplyDto p0);

    ExamApplyDto getApplyForScheduleItem(ExamApplyDto p0);

    int cancelScheduleInfo(ExamApplyDto p0, boolean p1);

    List<DictExamQueueDto> getQueueList(ExamApplyDto p0);

    List<DictExamQueueDto> getQueueListByDate(List<DictExamQueueDto> p0, String p1, Integer p2);

    Map<String, DictScheduleApmDto> getScheduleApmMap(DictScheduleApmDto p0);

    ExamScheduleApm examScheduleApm(String p0, List<String> p1, String p2);

    Map<String, ExamApplyDto> getOrgansInfo(Map<String, DictScheduleApmDto> p0, String p1, String p2, ExamApplyDto p3);

    Map<String, ExamApplyDto> getCountInfo(Map<String, DictScheduleApmDto> p0, String p1, String p2, ExamApplyDto p3);

    void listSortStartTime(List<ExamApplyDto> p0);

    void collectionSort(List<ExamApplyItemDto> p0, boolean p1);

    ExamApplyDto setApmLogic(ExamApplyDto p0, List<String> p1, Map<String, DictScheduleApmDto> p2);

    int saveScheduleApm(ExamApplyDto p0, ExamApplyDto p1, DictUsersDto p2);

    String saveScheduleItem(ExamApplyDto p0, ExamApplyDto p1, String p2, String p3);

    DictUsersDto dictUsers(ExamApplyDto p0);

    List<ExamApplyItemDto> getExamApplyItem(String p0, ExamApplyDto p1);

    boolean isScheduleSync(ExamApplyDto p0, String p1, String p2);

    void addExamScheduleAct(ExamApplyDto p0, DictUsersDto p1);

    void addExamSmsNotice(ExamApplyDto p0, String p1, ExamApplyDto p2);

    double getReqOrganByItems(List<ExamApplyItemDto> p0);

    List<String> getQueueNameList(Map<String, DictScheduleApmDto> p0, List<DictExamQueueDto> p1);

    boolean isEnabledScheduleApm(DictScheduleApmDto p0, ExamApplyDto p1, String p2);

    boolean quantityRuleJudge(ExamApplyDto p0, DictScheduleApmDto p1, String p2);

    String getScheduleTime(ExamSchedule p0, String p1);

    String getRegularId(List<String> p0, boolean p1);

    HashMap<String, Object> converPatternMap(ExamApplyDto p0, ExamApplyDto p1);

    void converPatternMap(ExamApplyDto ea, HashMap<String, Object> map, ExamApplyDto dto, String smsType);

    SignScheduleDto signSchedule(String p0, ExamApplyDto p1);

    void customSort(List<ExamApplyDto> p0, String terminalType);


    /**
     * 从shrio 里面获取当前登录的用户信息
     *
     * @return
     */
    DictUsersDto getLoginUser();


    String getChargeFlag(ExamApplyDto dto);

    /**
     * 获取历史申请单号
     * 通过第三方接口
     *
     * @param dto
     * @return
     */
    JsonResult getHisApplyByThirdUrl(ExamApplyDto dto);

    /**
     * @param sickId
     * @return 日期格式: yyyy-MM-dd
     * @description 获取患者最后生理日期
     * @author ryan.li
     * @date 2022/11/9 9:38
     */
    String getLastMensesDate(String sickId);

    /**
     * 获取检查项目列表里面对孕期有限制的检查项目列表
     *
     * @param itemsAll
     * @return
     */
    List<ExamApplyItemDto> getGestationalItems(List<ExamApplyItemDto> itemsAll);

    /**
     * 检查申请单预约渠道限制和
     *
     * @param itemsAll
     * @param terminalType
     * @param chargeType
     * @return
     */
    String isScheduleByFlags(List<ExamApplyItemDto> itemsAll, String terminalType, String chargeType);


    /**
     * @param lsExamApplyDto
     * @param user
     * @param planMode
     * @param terminalType
     * @param hospitalCode
     * @return
     * @description 按照预约计划-进行自动推荐预约操作（占用时段
     * @author ryan.li
     * @date 2022/11/9 9:42
     */
    String getSchedulePlans(List<ExamApplyDto> lsExamApplyDto, DictUsersDto user, String planMode, String terminalType, String hospitalCode);

    /**
     * @param items
     * @return true 包含 false 不包含
     * @description 检查项目里面是否包含 孕期限制的检查项目
     * @author ryan.li
     * @date 2022/11/9 9:44
     */
    boolean isGestationalApply(List<ExamApplyItemDto> items);

    /**
     * @param type
     * @param examClass
     * @param reserve1
     * @return
     * @description 获取友情提示
     * @author ryan.li
     * @date 2022/11/9 9:50
     */
    List<DictCommonUse> findReminderList(String type, String examClass, String reserve1);


    Integer getClassAttr(String examClass);

    /**
     * 验证合并规则
     *
     * @param examApplyDto
     * @param dto
     * @return
     */
    String mergeRuleForScheduleJudge(ExamApplyDto examApplyDto, ExamApplyDto dto);

    /**
     * 获取占号数量或占号系数
     *
     * @param ea
     */
    void getOrgansOrPower(ExamApplyDto ea);


    /**
     * @param lastMensesDate
     * @param items
     * @return startDate 可以预约的最早日期 endDate 可以检查的最晚日期
     * @description 根据患者的怀孕日期和检查项目列表获取 可以做检查的开始和结束日期
     * @author ryan.li
     * @date 2022/11/9 10:14
     */
    Map<String, String> getApplyGestDate(String lastMensesDate, List<ExamApplyItemDto> items);

    /**
     * 判断检查项目是否有自助签到限制的项目
     *
     * @param items
     * @return
     */
    String hasNoSignSelfItem(List<ExamApplyItemDto> items);


    /**
     * 构造时段信息
     * 最早预约、最找签到、时段长度等信息
     *
     * @param apmCode
     * @return
     */
    DictScheduleApmDto getTimeEarliest(String apmCode);

    /**
     * @param date
     * @param lastMensesDate
     * @param items
     * @return
     * @description 预约的日期是否在 怀孕可以预约的日期范围内
     * @author ryan.li
     * @date 2022/11/9 10:30
     */
    Boolean isGestationalDate(String date, String lastMensesDate, List<ExamApplyItemDto> items);

    /**
     * @param ea
     * @return
     * @description
     * @author ryan.li
     * @date 2022/11/9 10:33
     */
    Double getOrgansReqCount(ExamApplyDto ea);


    /**
     * 获取检查项目最早开始日期和时间
     *
     * @param items
     * @return
     */
    Map<String, Integer> getBeginDate(List<ExamApplyItemDto> items);


    /**
     * @param examClass
     * @param hospitalCode
     * @param itemCode
     * @return
     * @description 获取执行的科室编码和检查项目、检查类别
     * @author ryan.li
     * @date 2022/10/21 11:29
     */
    Map<String, Object> getPerformDeptCodeAndExamClassAndItems(String examClass, String hospitalCode, String itemCode);

    /**
     * @param ea
     * @param convertSms
     * @param dto
     * @return
     * @description 添加短信通知
     * @author ryan.li
     * @date 2022/11/9 10:47
     */
    Boolean addSmsByItemNotice(ExamApplyDto ea, List<Map<String, String>> convertSms, ExamApplyDto dto);

    /**
     * 【是否启用确认预约时判断确费】(1：关闭   0：启用)
     *
     * @param dto
     * @param actType
     * @param dictUsers
     * @return
     */
    JsonResult confirmFeeBeforeSchedule(ExamApplyDto dto, String actType, DictUsersDto dictUsers);


    /**
     * 锁定预约时段
     *
     * @param examApply
     * @param user
     * @return
     */
    JsonResult setApm(ExamApplyDto examApply, DictUsersDto user);

    /**
     * 修改预约时段
     *
     * @param dto
     * @param obj
     * @return
     */
    JsonResult editApm(ExamApplyDto dto, com.rt.schedulebase.dto.DictUsersDto obj);

    /**
     * 判断日期是否可以预约-号是否满
     *
     * @param queues
     * @param date
     * @param examApply
     * @return
     */
    ExamApplyDto getScheduleDate(List<DictExamQueueDto> queues, String date, ExamApplyDto examApply);

    /**
     * @param examApply
     * @param date
     * @return
     * @description 获取申请单选择的日期可以预约的时段列表
     * @author ryan.li
     * @date 2022/11/9 10:55
     */
    JsonResult getScheduleApm(ExamApplyDto examApply, String date);

    /**
     * 取消预约或者取消报到执行退费操作
     *
     * @param dto
     * @param actType
     * @param dictUsers
     * @return
     */
    JsonResult recedeCost(ExamApplyDto dto, String actType, com.rt.schedulebase.dto.DictUsersDto dictUsers);

    /**
     * 组装返回结果
     *
     * @param list
     * @param dto
     */
    void assembleResult(List<ExamApplyDto> list, ExamApplyDto dto);

    /**
     * 报道时确费
     *
     * @param dto
     * @param actType
     * @param dictUsers
     * @return
     */
    JsonResult confirmFeeBeforeSign(ExamApplyDto dto, String actType, DictUsersDto dictUsers);

    void addExamScheduleApmRegular(boolean isExamClass4Organ, List<String> regularIdList, String scheduleDate, boolean isGreenChannel);

    /***
     * 保存检查信息引用
     * @param examApply
     * @param queueName
     * @return
     */
    int saveRefer(ExamApplyDto examApply, String queueName);


    /**
     * 取消预约时段
     *
     * @param dto
     */
    void cancelScheduleApm(ExamApplyDto dto);


    /**
     * 去掉检查子项为空的项目
     *
     * @param items
     * @param examSubClass
     */
    void handItemCode(List<ExamApplyItemDto> items, String examSubClass);


    /**
     * @param dto
     * @return
     * @description 取消预约签到
     * @author ryan.li
     * @date 2022/10/17 14:13
     */
    JsonResult cancelSign(ExamApplyDto dto);

    /**
     * 检查类别是否 【按项目预约量系数占号的检查类别】
     * 1 : 否
     * 2: 是
     *
     * @param examClass
     * @return
     */
    String getLimitType(String examClass);


    /**
     * @param apmCodes
     * @param regularId
     * @param scheduleDate
     * @param itemCodes
     * @return
     * @description 获取时段预约规则限制可以预约的数量
     * @author ryan.li
     * @date 2022/11/9 11:16
     */
    double getExamScheduleApmRegular(List<String> apmCodes, String regularId, String scheduleDate, List<String> itemCodes);


    /** 获取申请单最早可以预约的时间和最晚预约的时间
     * @param applyNo
     * @param hospitalCode
     * @param patientSource
     * @param itemBeginDays
     * @return
     * @description
     * @author ryan.li
     * @date `2022/11/9` 11:18
     */
    Map<String, String> getBeginDateAndExpireDate(String applyNo, String hospitalCode, String patientSource, int itemBeginDays);


    /**
     * 孕期最早可以做检查的时间
     * @param lastMensesDate
     * @param items
     * @return
     */
    String getStartDate(String lastMensesDate, List<ExamApplyItemDto> items);

    /**
     * 孕期最晚可以做检查的时间
     * @param lastMensesDate
     * @param items
     * @return
     */
    String getExpireDate4Gestational(String lastMensesDate, List<ExamApplyItemDto> items);


    /**
     * 是否还有其他的时段可以预约
     *
     * @param examScheduleDto
     * @param isSchedulePlan
     * @return
     */
    boolean hasOtherSchedule(ExamScheduleDto examScheduleDto, boolean isSchedulePlan);

    /**
     * 获取预约时段的范围
     * @param timeStart
     * @param endStart
     * @return
     */
    String getScheduleApmScope(String timeStart, String endStart);

    /**
     * 获取候诊信息
     * @param ea
     * @return
     */
    WaitingDto getWaitingInfo(ExamApplyDto ea);
}
